package c.h.b.a.b;

import android.content.Context;
import android.util.Log;
import android.view.View;
import com.bytedance.sdk.openadsdk.TTAdNative.NativeExpressAdListener;
import com.bytedance.sdk.openadsdk.TTNativeExpressAd;
import java.util.List;

/* compiled from: TTAdLoader */
public class h implements NativeExpressAdListener {
    public final /* synthetic */ c.h.b.a.a.a a;
    public final /* synthetic */ c.h.b.a.a.b b;
    public final /* synthetic */ String c;
    public final /* synthetic */ Context d;

    /* compiled from: TTAdLoader */
    public class b extends i {
        public b(h hVar) {
        }
    }

    /* compiled from: TTAdLoader */
    public class a extends d {
        public void onAdClicked(View view, int i) {
            h.this.b.a();
        }

        public void onAdShow(View view, int i) {
            h.this.b.b();
        }

        public void onRenderFail(View view, String str, int i) {
            if (c.a) {
                StringBuilder j = c.b.a.a.a.j("头条广告渲染失败 = ", str, ", adItem = ");
                j.append(h.this.a);
                Log.d("AlphaAdLoader", j.toString());
            }
            c.h.b.a.a.b bVar = h.this.b;
            StringBuilder g = c.b.a.a.a.g("tt-");
            g.append(h.this.c);
            g.append(":render fail");
            bVar.d(g.toString());
        }

        public void onRenderSuccess(View view, float f, float f2) {
            h.this.b.e(view);
            if (c.a) {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.append("onRenderSuccess: v = ");
                stringBuilder.append(f);
                stringBuilder.append(", v1 = ");
                stringBuilder.append(f2);
                Log.d("AlphaAdLoader", stringBuilder.toString());
            }
        }
    }

    public h(g gVar, c.h.b.a.a.a aVar, c.h.b.a.a.b bVar, String str, Context context) {
        this.a = aVar;
        this.b = bVar;
        this.c = str;
        this.d = context;
    }

    public void onError(int i, String str) {
        if (c.a) {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("头条广告请求失败，code = ");
            stringBuilder.append(i);
            stringBuilder.append(", msg = ");
            stringBuilder.append(str);
            stringBuilder.append(", adItem = ");
            stringBuilder.append(this.a);
            Log.d("AlphaAdLoader", stringBuilder.toString());
        }
        c.h.b.a.a.b bVar = this.b;
        StringBuilder g = c.b.a.a.a.g("tt-");
        g.append(this.c);
        g.append(":code=");
        g.append(i);
        g.append(",msg=");
        g.append(str);
        bVar.d(g.toString());
    }

    public void onNativeExpressAdLoad(List<TTNativeExpressAd> list) {
        if (list.isEmpty()) {
            if (c.a) {
                StringBuilder g = c.b.a.a.a.g("头条广告请求失败，广告列表为空 = ");
                g.append(this.a);
                Log.d("AlphaAdLoader", g.toString());
            }
            c.h.b.a.a.b bVar = this.b;
            StringBuilder g2 = c.b.a.a.a.g("tt-");
            g2.append(this.c);
            g2.append(":empty");
            bVar.d(g2.toString());
            return;
        }
        TTNativeExpressAd tTNativeExpressAd = (TTNativeExpressAd) list.get(0);
        tTNativeExpressAd.setExpressInteractionListener(new a());
        tTNativeExpressAd.setDislikeDialog(new e(this.d, this.b));
        tTNativeExpressAd.setDownloadListener(new b(this));
        tTNativeExpressAd.render();
    }
}
